/* *****************************************************************************
 * JFab (http://code.google.com/p/jfab)
 * Copyright (c) 2011 JFab.org
 * Admin jfab@jeffreythompson.net
 *
 * See the file "LICENSE.txt" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * *****************************************************************************/


package org.jfab.core.collection;

import java.util.Collection;
import java.util.Map;
import java.util.Set;


/**
 * Provides base functionality for a code generator map.
 *
 * @param  <K>  Key.
 * @param  <V>  Value.
 */
public class CGMap<K, V> implements Map<K, V>
{
    /** Map. */
    private final Map<K, V> _map;

    /**
     * Construct this object with the given parameter.
     *
     * @param  map  Map.
     */
    protected CGMap(Map<K, V> map)
    {
        _map = map;
    }

    @Override public void clear()
    {
        _map.clear();
    }

    @Override public boolean containsKey(Object key)
    {
        return _map.containsKey(key);
    }

    @Override public boolean containsValue(Object value)
    {
        return _map.containsValue(value);
    }

    @Override public Set<java.util.Map.Entry<K, V>> entrySet()
    {
        return _map.entrySet();
    }

    @Override public boolean equals(Object o)
    {
        return _map.equals(o);
    }

    @Override public V get(Object key)
    {
        return _map.get(key);
    }

    @Override public int hashCode()
    {
        return _map.hashCode();
    }

    @Override public boolean isEmpty()
    {
        return _map.isEmpty();
    }

    @Override public Set<K> keySet()
    {
        return _map.keySet();
    }

    @Override public V put(K key, V value)
    {
        return _map.put(key, value);
    }

    @Override public void putAll(Map<? extends K, ? extends V> m)
    {
        _map.putAll(m);
    }

    @Override public V remove(Object key)
    {
        return _map.remove(key);
    }

    @Override public int size()
    {
        return _map.size();
    }

    @Override public Collection<V> values()
    {
        return _map.values();
    }

    /**
     * @return  the map
     */
    protected Map<K, V> getMap()
    {
        return _map;
    }
}
